<script>
	import dbOper from '@/module/accountSqlOper'
	export default {
		onLaunch: function() {
			this.hasDbFile()
		},
		onShow: function() {

		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			goIndex() {
				setTimeout(() => {
					uni.redirectTo({
						url: '/pages/index/index'
					});
				}, 500)
			},
			goErrpage() {
				setTimeout(() => {
					uni.redirectTo({
						url: '/pages/home/home'
					});
				}, 500)
			},
			hasDbFile(parrams) { //判断是否有数据库文件
				dbOper.checkDb()
					.then(res => {
						this.goIndex()
					})
					.catch(err => {
						this.goErrpage()
					})
			}
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	/* #ifndef APP-NVUE */
	@import '@/static/customicons.css';

	// 设置整个项目的背景色
	page {
		background-color: #f5f5f5;
	}

	/* #endif */
	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}
</style>